package threadDemo;

/**
 * 测试守护线程
 */
public class Test14 {
    public static void main(String[] args) {
        Gad g = new Gad();
        Parson p = new Parson();
        Thread t = new Thread(g);
        t.setDaemon(true);
        t.start();
        new Thread(p).start();
    }
}

class Gad implements Runnable {
    @Override
    public void run() {
        while (true){
            System.out.println("上帝守护");
        }
    }
}

class Parson implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 30000; i++) {
            System.out.println("活了 "+i+" 天");
        }
    }
}

